﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="YinHangZCL.aspx.cs" Inherits="Web.Pages.YongShui.ZhangWuGL.YinHangZCL" Theme="Default" ValidateRequest="false" %>
<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../../../css/inputBgColor.css" rel="stylesheet" />
    <script src="../../../JS/AddEditCancel.js" type="text/javascript"></script>
    <script src="../../../JS/jquery.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            hdCollection.Set("ID", -1);
        });

        function search() {
            if (txtZhangWuNY.GetText() == "") {
                alert("请先输入账务年月！");
                return;
            }
            hdCollection.Set("ID", -1);
        }
        function display(op, id) {
            //hdCollection.Set("ID", id);
            if (op == "add") {
                //btnTianJia.SetVisible(false);
                //btnDaYin.SetVisible(false);
                //$("#GridViewContentTable").css("display","block");
                //lblOperateTip.SetText("添加");
                cbmKeMu2.Focus();
                listCover(true, "gridTab");
            }
            else if (op == "edit") {
                hdCollection.Set("ID", id);
                //btnTianJia.SetVisible(false);
                //btnDaYin.SetVisible(false);
                //lblOperateTip.SetText("修改");
                //$("#GridViewContentTable").css("display", "block");
                listCover(true, "gridTab");
                ASPxCallback1.PerformCallback("edit");
            }
            else {
                listCover(false, "gridTab");

                //$("#GridViewContentTable").hide();
                //btnTianJia.SetVisible(true);
                //btnDaYin.SetVisible(true);
                cbmKeMu2.SetText('');
                txtJinE.SetText('');
                txtBeiZhu.SetText('');
            }
        }

        function del(id) {
            hdCollection.Set("ID", id);
            if (confirm("确认删除吗？")) {
                ASPxCallback1.PerformCallback("del");
            }
            else {
                hdCollection.Set("ID", -1);
            }
        }

        function save() {
            if (cbmKeMu2.GetText() == "") {
                alert("请选择科目类型！");
                cbmKeMu2.Focus();
                return;
            }
            if (txtJinE.GetText() == "") {
                alert("请输入金额！");
                txtJinE.Focus();
                return;
            }
            listCover(false, "gridTab");
            //hdCollection.Set("ID", gvYinHangZCL.GetRowKey(gvYinHangZCL.GetFocusedRowIndex()));
            ASPxCallback1.PerformCallback("save");
        }

        function ASPxCallback1Complete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];
            if (state != "0") {
                alert(arr[2]);
            }
            else {
                if (type == "edit") {
                    cbmKeMu2.SetText(arr[3]);
                    txtJinE.SetText(arr[4]);
                    txtBeiZhu.SetText(arr[5]);
                   
                    //lbZongYeStab1.SetText("共" + arr[8] + "条");
                    if (arr[6] == "1") {
                        chkShouGongCLZM2.SetChecked (true);
                    }
                    else {
                        chkShouGongCLZM2.SetChecked(false);
                    }
                    txtZongJinE.SetText(arr[7]);
                }
                else if (type == "del") {
                    alert(arr[2]);
                    txtZongJinE.SetText(arr[3]);
                    lbZongYeStab1.SetText("共" + arr[4] + "条");
                    gvYinHangZCL.PerformCallback();
                }
                else if (type == "save") {
                    hdCollection.Set("ID", -1);
                    alert(arr[2]);
                    txtZongJinE.SetText(arr[3]);
                    lbZongYeStab1.SetText("共" + arr[4] + "条");
                    display("init", -1);
                    gvYinHangZCL.PerformCallback();
                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div class="tabletitle1" align="center">
            银行账处理
        </div>
        <div style="display: none;">
            <dx:ASPxHiddenField ID="hdCollection" ClientInstanceName="hdCollection" runat="server"></dx:ASPxHiddenField>
            <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallback1Complete(e.result);}"></dx:ASPxCallback>
        </div>
        <asp:UpdatePanel ID="updatePanel1" runat="server">
            <ContentTemplate>
                <div>
                    <div>
                        <table style="text-align: left;">
                            <tr>
                                <td><span style="font-size: 12px;">账务年月：</span></td>
                                <td>
                                    <dx:ASPxTextBox ID="txtZhangWuNY" Width="60%" runat="server"  ClientEnabled="true" ClientInstanceName="txtZhangWuNY">
                                        <ClientSideEvents KeyUp="function(s,e){inputNum(s);}" />
                                    </dx:ASPxTextBox>
                                </td>
                                <td>
                                    <span style="font-size: 12px;">科目：</span>
                                </td>
                                <td>
                                    <asp:Panel runat="server" ID="Panel1">
                                        <dx:ASPxComboBox runat="server" ID="cmbKeMu" Width="80%">
                                            <Items>
                                                <dx:ListEditItem Text="全部" Value="0" Selected="true" />
                                            </Items>
                                        </dx:ASPxComboBox>
                                    </asp:Panel>
                                </td>
                                <td>
                                    <dx:ASPxCheckBox runat="server" Checked="true" ID="chbShouGongCLZM" Text="手工处理账目" ></dx:ASPxCheckBox>
                                </td>
                                <td style="width:20%;">&nbsp;</td>
                                <td>
                                    <dx:ASPxLoadingPanel runat="server" ID="LoadPanel" ClientInstanceName="LoadPanel" Text="正在查询"></dx:ASPxLoadingPanel>
                                    <dx:ASPxButton runat="server" ID="btnChaXun" Text="查询" OnClick="btnChaXun_Click" UseSubmitBehavior="false">
                                        <ClientSideEvents Click="function(s,e){LoadPanel.Show();search();}" />
                                    </dx:ASPxButton>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="gridTab">
                        <dx:ASPxGridView ID="gvYinHangZCL" ClientInstanceName="gvYinHangZCL" runat="server" AutoGenerateColumns="False" KeyFieldName="ID" Theme="Aqua1" 
                            OnCustomCallback="gvYinHangZCL_CustomCallback" Width="100%">
                            <Columns>
                                <dx:GridViewDataTextColumn FieldName="S_MINGCHENG" Caption="科目" Width="8%">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="" Caption="借贷" Width="5%">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="N_JINE" Caption="金额" Width="10%">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="D_SHURURQ" Caption="输入日期" Width="15%" PropertiesTextEdit-DisplayFormatString="yyyy-MM-dd">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_BEIZHU" Caption="备注" Width="55%">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Width="5%">
                                    <DataItemTemplate>
                                        <%--<asp:LinkButton ID="lnbModify" runat="server" CausesValidation="false" Text="修改"
                                            CommandArgument='<%#Eval("ID")%>' OnCommand="lnbModify_Command"></asp:LinkButton>--%>
                                        <a href="#" onclick="display('edit','<%#Eval("ID")%>')">修改</a>
                                    </DataItemTemplate>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Width="5%">
                                    <DataItemTemplate>
                                        <a href="#" onclick="del('<%#Eval("ID")%>')">删除</a>
                                        <%--<asp:LinkButton ID="lnbDel" runat="server" CausesValidation="false" Text="删除" OnClientClick="return confirm('确认删除吗？')" CommandArgument='<%#Eval("ID")%>' OnCommand="lnbDel_Command"></asp:LinkButton>--%>
                                    </DataItemTemplate>
                                </dx:GridViewDataTextColumn>
                            </Columns>
                            <Settings  VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" />
                            <ClientSideEvents Init="function(s,e){AdjustSize(280,gvYinHangZCL);}" />
                        </dx:ASPxGridView>
                    </div>
                    <div style="height: 60px;">
                        <table align="right">
                            <tr>
                                <td style="width:150px;">
                                     <dx:ASPxLabel runat="server" ForeColor="Blue" ID="lbZongYeStab1" Text="共0条" ClientInstanceName="lbZongYeStab1"></dx:ASPxLabel> 
                                </td>
                                <td><span style="font-size: 12px;">总金额：</span></td>
                                <td colspan="2">
                                    <dx:ASPxTextBox ID="txtZongJinE" Width="100%" runat="server" ClientInstanceName="txtZongJinE"   HorizontalAlign="Right" Paddings-PaddingRight="20">
                                    </dx:ASPxTextBox>
                                </td>
                            </tr>
                            <tr>
                                <td></td>
                                <td>
                                   <%-- <dx:ASPxButton ID="btnTianJia" runat="server" Text="添加" ClientInstanceName="btnTianJia"  AutoPostBack="false" UseSubmitBehavior="false">
                                        <ClientSideEvents  Click="function(s,e){display('add',-1)}"/>
                                    </dx:ASPxButton>--%>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="GridViewContentTable" runat="server" >
                        <%--<div class="tabletitle1" align="center">
                            <dx:ASPxLabel ID="lblOperateTip" runat="server" ClientInstanceName="lblOperateTip" Text="添加"></dx:ASPxLabel>
                        </div>--%>
                        <hr />
                        <div style="width: 100%;">
                            <table  style="">
                                <tr>

                                    <td>
                                        <span style="font-size: 13px;width:40px;">科目：</span>
                                    </td>

                                    <td style="width:120px;">
                                        <asp:Panel runat="server" ID="Panel2">
                                            <dx:ASPxComboBox runat="server" ID="cbmKeMu2" Width="80%" ClientInstanceName="cbmKeMu2">
                                                <ClientSideEvents  KeyPress="function(s,e){OnKeyNext(txtJinE);}" />
                                            </dx:ASPxComboBox>
                                        </asp:Panel>

                                    </td>
                                    <td><span style="font-size: 13px;width:40px;">金额：</span></td>
                                    <td style="width:120px;">
                                        <dx:ASPxTextBox ID="txtJinE" ClientInstanceName="txtJinE" Width="80%" runat="server"  ClientEnabled="true">
                                            <ClientSideEvents  KeyPress="function(s,e){OnKeyNext(txtBeiZhu);}" />
                                        </dx:ASPxTextBox>
                                    </td>
                                    <td style="width:180px;">
                                        <dx:ASPxCheckBox runat="server" ID="chkShouGongCLZM2" Checked="true" Text="手工处理账目" ClientInstanceName="chkShouGongCLZM2" ></dx:ASPxCheckBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td><span style="font-size: 13px;width:40px;">备注：</span></td>
                                    <td colspan="4" style="width:120px;">
                                        <dx:ASPxTextBox ID="txtBeiZhu" ClientInstanceName="txtBeiZhu" Width="80%" runat="server"  ClientEnabled="true">
                                            <ClientSideEvents  KeyPress="function(s,e){OnKeyNext(btnBaoCun);}" />
                                        </dx:ASPxTextBox>
                                    </td>
                                </tr>
                            </table>
                            <table style="width: 30%; height: 10px;">
                                <tr>
                                    <td></td>
                                </tr>
                            </table>
                        </div>
                        <div style="width: 100%;">
                            
                            <table style="float:left;">
                                <tr>
                                    <td>
                                        <dx:ASPxButton runat="server" ID="btnBaoCun" ClientInstanceName="btnBaoCun" Text="保存" UseSubmitBehavior="false" AutoPostBack="false">
                                            <ClientSideEvents Click="function(s,e){save();}" />
                                        </dx:ASPxButton>
                                    </td>
                                    <td>&nbsp;&nbsp;
                                        <dx:ASPxButton runat="server" ID="btnFangQi" Text="放弃"  UseSubmitBehavior="false" AutoPostBack="false">
                                            <ClientSideEvents  Click="function(s,e){display('init',-1);}"/>
                                        </dx:ASPxButton>
                                    </td>
                                    <td>&nbsp;&nbsp;
                                        <dx:ASPxButton ID="btnDaYin" runat="server" Text="打印" ClientInstanceName="btnDaYin" OnClick="btnDaYin_Click" UseSubmitBehavior="false">
                                        </dx:ASPxButton>
                                    </td>
                                </tr>
                            </table>
                        </div>

                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>
